import request from '@/utils/request'
import type { SkuResponseData, SkuInfoData } from './type'
enum API {
  sku_List = '/admin/product/list/',
  // 上架
  saleSku = '/admin/product/onSale/',
  // 下架
  UnSaleSku = '/admin/product/cancelSale/',
  // 查看当前sku信息
  curSkuInfo = '/admin/product/getSkuInfo/',
  // 删除当前sku
  deleteCurSku = '/admin/product/deleteSku/',
}

export const getSkuList = (pageNo: number, pageSize: number) => {
  return request.get<any, SkuResponseData>(
    API.sku_List + `${pageNo}/${pageSize}`,
  )
}

export const saleSkuProduct = (skuId: number) => {
  return request.get<any, any>(API.saleSku + skuId)
}
export const unSaleSkuProduct = (skuId: number) => {
  return request.get<any, any>(API.UnSaleSku + skuId)
}
export const reqCurSkuInfo = (skuId: number) => {
  return request.get<any, SkuInfoData>(API.curSkuInfo + skuId)
}
export const reqDeleteCurSku = (skuId: number) => {
  return request.delete<any, SkuInfoData>(API.deleteCurSku + skuId)
}
